<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>登录页面</title>
    <link rel="stylesheet" type="text/css" href="static/css/style.css">
    <style>
        .login-form {
            max-width: 400px;
            margin: 100px auto;
            padding: 20px;
            background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        .login-form h2 {
            text-align: center;
            margin-bottom: 20px;
            color: #333; /* 字体颜色 */
        }

        .login-form label {
            display: block;
            margin-bottom: 5px;
            font-weight: bold;
            color: #333; /* 字体颜色 */
        }

        .login-form input[type="text"],
        .login-form input[type="password"],
        .login-form input[type="email"] {
            width: 100%;
            padding: 10px;
            margin-bottom: 15px;
            border: 1px solid #ccc;
            border-radius: 4px;
        }

        .login-form input[type="submit"] {
            width: 100%;
            padding: 10px;
            background-color: #007bff;
            color: white;
            border: none;
            border-radius: 4px;
            cursor: pointer;
        }

        .login-form input[type="submit"]:hover {
            background-color: #0056b3;
        }

        .login-form .message {
            text-align: center;
            margin-bottom: 20px;
        }

        .login-form .message.error {
            color: red;
        }
    </style>
</head>
<body>
<header>
    <h1>电子商务系统 - 登录</h1>
    <nav>
        <ul>
            <li><a href="index.jsp">首页</a></li>
            <li><a href="products.jsp">产品列表</a></li>
            <li><a href="cart.jsp">购物车</a></li>
            <li><a href="login.jsp">登录</a></li>
            <li><a href="register.jsp">注册</a></li>
        </ul>
    </nav>
</header>
<main>
    <section class="login-form">
        <h2>用户登录</h2>
        <form action="LoginServlet" method="post">
            <label for="username">用户名:</label>
            <input type="text" id="username" name="username" required><br><br>
            <label for="password">密码:</label>
            <input type="password" id="password" name="password" required><br><br>
            <input type="submit" value="登录">
        </form>
        <%
            String errorMessage = (String) request.getAttribute("errorMessage");
            if (errorMessage != null) {
        %>
        <div class="message error"><%= errorMessage %></div>
        <%
            }
        %>
    </section>
</main>
<footer>
    <p>&copy; 2023 电子商务系统. All rights reserved.</p>
</footer>
<script src="static/js/main.js"></script>
</body>
</html>
